import request from '@/utils/request';
import type { AxiosPromise } from '@/utils/request';
import type { CompletionAcceptanceVO, CompletionAcceptanceForm, CompletionAcceptanceQuery } from '@/pagesA/api/workflow/completionAcceptance/types';

/**
 * 查询完工验收单列表
 * @param query
 * @returns {*}
 */

export const listCompletionAcceptance = (query?: CompletionAcceptanceQuery): AxiosPromise<CompletionAcceptanceVO[]> => {
  return request({
    url: '/workflow/completionAcceptance/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询完工验收单详细
 * @param id
 */
export const getCompletionAcceptance = (id: string | number): AxiosPromise<CompletionAcceptanceVO> => {
  return request({
    url: '/workflow/completionAcceptance/' + id,
    method: 'get'
  });
};

/**
 * 新增完工验收单
 * @param data
 */
export const addCompletionAcceptance = (data: CompletionAcceptanceForm) => {
  return request({
    url: '/workflow/completionAcceptance',
    method: 'post',
    data: data
  });
};

/**
 * 修改完工验收单
 * @param data
 */
export const updateCompletionAcceptance = (data: CompletionAcceptanceForm) => {
  return request({
    url: '/workflow/completionAcceptance',
    method: 'put',
    data: data
  });
};

/**
 * 删除完工验收单
 * @param id
 */
export const delCompletionAcceptance = (id: string | number | Array<string | number>) => {
  return request({
    url: '/workflow/completionAcceptance/' + id,
    method: 'delete'
  });
};
